package com.detrum.detrumdx.adapter;


/**
 * Created by abc on 2018/2/1.
 */

// TODO: 2018/5/24 蓝牙相关
public class BluetoothInfoAdapter{
    /*private Context context;
    private List<ScanResult> resultList;
    private LayoutInflater layoutInflater;

    public BluetoothInfoAdapter(Context context, List<ScanResult> resultList) {
        this.context = context;
        this.resultList = resultList;
        layoutInflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return resultList == null ? 0 : resultList.size();
    }

    @Override
    public Object getItem(int position) {
        return resultList.get(position).getRssi();
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        BluetoothHolder holder;
        if (convertView == null) {
            convertView = layoutInflater.inflate(R.layout.wifi_item, parent, false);
            holder = new BluetoothHolder();
            holder.name = convertView.findViewById(R.id.wifi_name);
            holder.isConnect = convertView.findViewById(R.id.connect);
            holder.RSSI = convertView.findViewById(R.id.wifi_rssi);
            convertView.setTag(holder);
        } else {
            holder = (BluetoothHolder) convertView.getTag();
        }
        holder.name.setText(resultList.get(position).getDevice().getName());
        int rssi = resultList.get(position).getRssi();
        if (rssi == 0) {
            holder.isConnect.setText(R.string.no_sign);
            holder.RSSI.setVisibility(View.GONE);
        } else if (rssi > 0 && rssi <= 30) {
            holder.isConnect.setVisibility(View.GONE);
            holder.RSSI.setImageResource(R.mipmap.ic_rssi_1);
        } else if (rssi > 30 && rssi <= 70) {
            holder.isConnect.setVisibility(View.GONE);
            holder.RSSI.setImageResource(R.mipmap.ic_rssi_2);
        } else {
            holder.isConnect.setVisibility(View.GONE);
            holder.RSSI.setImageResource(R.mipmap.ic_rssi);
        }
        return convertView;
    }

    class BluetoothHolder {
        TextView name;
        TextView isConnect;
        ImageView RSSI;
    }*/
}
